<template>
	<view>
		<view style="position: relative;" v-if="postData.count>0" v-for="(item,index) in postData.list" :key="index"
			@click="openInfo(item)">
			<view style="background-color: #fff;border-top: 1px solid #eee;padding: 15px;">
				<view style="font-weight: bold;">订单号：{{item.order_no}}</view>
				<view style="color: #666;" v-for="(itm,idx) in item.goods_list">
					{{itm.sku_name}} x{{itm.num}} ¥{{itm.goods_money}}
				</view>
				<view style="font-size: 12px;color: #999;">
					下单时间：{{item.pay_time}} 订单金额：{{item.goods_money}}元
				</view>
				<view style="font-size: 12px;color: #00aa00;display: flex;align-items: center;justify-content: space-between;">
					<text v-if="item.invoice_status==1">开票时间：{{item.invoice_time}}</text>
					<text style="color: #000;">{{item.is_tax_invoice_cn}}</text>
				</view>
			</view>

			<view style="position: absolute;top: 10px;right: 10px;display: flex;align-items: center;">
				<view style="color: #999;">{{item.invoice_status_cn}}</view>
				<view style="padding-top: 2px;">
					<text class="iconfont icon-right " style="color: #a8a8a8;font-size: 16px;"></text>
				</view>
			</view>
		</view>
		<view v-if="postData.count==0" style="color: #999;padding-top: 50%;text-align: center;" >
			暂无开票记录
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				postData:[],
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			openInfo(item){
				if(item.invoice_status==1){
					this.$util.redirectTo('/pages_tool/invoice/invoice-detail?order_id='+item.order_id)
				}else{
					uni.showModal({
						title: '提示',
						content: '开票成功后可查看',
						showCancel:false
					});
				}
				
			},
			init(){
				this.$api.sendRequest({
					url: '/api/order/invoiceHistory',
					data: {
						page: 1,
						limit: 10
					},
					success: res => {
						this.postData = res.data;
					}
				})
			}
		}
	}
</script>

<style>

</style>